fix(lessons): theory shows what the terminal prints, checked by a permanent replay (THI-353) - #391
Conversation
…manent replay (THI-353) - Replay every terminal session shown in a lesson code block through the engine, from the lesson's starting state, in each environment (src/test/lessonTheory.test.ts). Known gaps are a shrink-only ratchet (lessonTheoryGaps.ts, 174 entries), plus a ceiling on lessons that show bash to Windows learners (39). - Fix 13 lesson examples whose output did not match (ls -l, ls -a, grep -n, wc, chmod, chown, apt, stderr, Windows ping) and give the PATH and git init lessons a single block per environment. - ls -l size comes from the content bytes, like wc -c. - $env:X = "..." expands $env:Y inside double quotes (PowerShell). - git init prints C:/Users/user/... on Windows, like Git for Windows. - CHANGELOG and STORY: catch up #389 and #390, add this change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Sorry @thierryvm, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 2 days and 5 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Guide du réviseurCette PR rend la théorie des leçons exécutable et vérifiée en continu : elle rejoue 754 commandes de terminal depuis les états initiaux des leçons dans tous les environnements pris en charge, corrige les transcriptions de cursus incohérentes, aligne le comportement du moteur sur ces transcriptions et utilise un mécanisme de suivi des écarts qui ne peut que se réduire afin d’éviter les régressions de fidélité. Diagramme de séquence pour le rejeu permanent de la théorie des leçonssequenceDiagram
participant Test as lessonTheory.test
participant Lesson as Lesson curriculum
participant Setup as Exercise.setup
participant Engine as terminalEngine
participant Gaps as lessonTheoryGaps
Test->>Lesson: Lire les blocs de code du terminal
Test->>Setup: Créer l’état initial de la leçon
Setup-->>Test: Renvoyer TerminalState
loop Linux, macOS, Windows
Test->>Engine: Rejouer les commandes de la leçon
Engine-->>Test: Renvoyer la sortie du terminal
Test->>Test: Comparer la sortie avec le texte de la leçon
end
Test->>Gaps: Vérifier les commandes non correspondantes
Gaps-->>Test: Autoriser uniquement les écarts existants
Test-->>Test: Échouer en cas de nouveaux écarts ou d’entrées non corrigées
Modifications au niveau des fichiers
Conseils et commandesInteragir avec Sourcery
Personnaliser votre expérienceAccédez à votre tableau de bord pour :
Obtenir de l’aide
Original review guide in EnglishReviewer's GuideThis PR makes lesson theory executable and continuously checked: it replays 754 terminal commands from lesson starting states across all supported environments, corrects mismatched curriculum transcripts, aligns engine behavior with those transcripts, and uses a shrink-only gap ratchet to prevent fidelity regressions. Sequence diagram for permanent lesson theory replaysequenceDiagram
participant Test as lessonTheory.test
participant Lesson as Lesson curriculum
participant Setup as Exercise.setup
participant Engine as terminalEngine
participant Gaps as lessonTheoryGaps
Test->>Lesson: Read terminal code blocks
Test->>Setup: Create lesson starting state
Setup-->>Test: Return TerminalState
loop Linux, macOS, Windows
Test->>Engine: Replay lesson commands
Engine-->>Test: Return terminal output
Test->>Test: Compare output with lesson text
end
Test->>Gaps: Check unmatched commands
Gaps-->>Test: Allow only existing gaps
Test-->>Test: Fail on new gaps or unfixed gap entries
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Why
Exercises are fixed (#389, #390); the lesson theory still showed output the terminal does not print — a beginner who types the example sees something else. THI-353.
What
src/test/lessonTheory.test.tsreplays every terminal session shown in a lesson code block through the engine, from the lesson's own starting state (Exercise.setup), in linux / macos / windows, and compares with the lesson text. 754 commands replayed; 390 match.lessonTheoryGaps.ts, 174 entries — mostly advanced Git/GitHub lessons whose starting state lacks the history their theory shows, plusghand background jobs not simulated yet). A new gap fails; a fixed gap fails until its entry is removed.BASH_SHOWN_ON_WINDOWS_MAX = 39: lessons whose code blocks show bash to a Windows learner. Can only go down.ls -l(time, byte sizes),ls -a(.zshrc),grep -n(line 6),wc(6 22 143), permissions listing,chmod/chownsizes,apt(noble),2>example, WindowspingTTL.git initlessons (was: bash and PowerShell shown side by side to everyone); PATH warning gets a PowerShell variant ($PROFILE).ls -lsize = content bytes (same aswc -c);$env:X = "…$env:Y…"expands in double quotes, literal in single quotes;git initprintsC:/Users/user/…on Windows like Git for Windows.Found on the way (next PR)
mv documents/notes.txt .replaces the home directory with the file;cp file dir/Move-Item file diroverwrite the directory;mv -itreats-ias a path. Dedicated fix next.Gates
git initlesson — typed the theory commands, terminal output identical to the lesson🤖 Generated with Claude Code
Résumé par Sourcery
Faire en sorte que la théorie des leçons reflète fidèlement la sortie du terminal et vérifier en continu cette correspondance sous Linux, macOS et Windows.
Corrections de bugs :
Améliorations :
PATHet degit-initspécifiques à l’environnement au lieu de présenter simultanément des variantes de shell incompatibles.pingsous Windows, sur le contenu des leçons.Documentation :
Tests :
lscalculées dynamiquement.Original summary in English
Summary by Sourcery
Make lesson theory faithfully reflect terminal output and continuously verify that alignment across Linux, macOS, and Windows.
Bug Fixes:
Enhancements:
Documentation:
Tests: